package com.lingshu.app.database.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import com.lingshu.app.database.bean.ImageBean;

import java.util.List;

import io.reactivex.Completable;
import io.reactivex.Flowable;

/**
 * @author 于定金
 * @version 1.0
 * @Date 2023/12/27 14:18
 * @Description
 */
@Dao
public interface ImageDao {
    @Query("SELECT * FROM images")
    List<ImageBean> getAll();

    @Query("SELECT * FROM images WHERE uid LIKE :uid LIMIT 1")
    Flowable<ImageBean> queryById(int uid);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    Completable insertAll(ImageBean... images);

    @Delete
    void delete(ImageBean image);
}
